package com.social.instadownloader.network;

import java.io.IOException;
import java.io.InputStream;
import java.net.SocketTimeoutException;

import javax.net.ssl.SSLPeerUnverifiedException;

import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;

public class HttpConnection
{
  private static final int TIMEOUT = 10000;

  public static InputStream connectGetMethod(String paramString1, String paramString2)
    throws SSLPeerUnverifiedException, SocketTimeoutException, ClientProtocolException, IOException
  {
    BasicHttpParams localBasicHttpParams = new BasicHttpParams();
    HttpConnectionParams.setConnectionTimeout(localBasicHttpParams, 10000);
    HttpConnectionParams.setSoTimeout(localBasicHttpParams, 7000);
    DefaultHttpClient localDefaultHttpClient = new DefaultHttpClient(localBasicHttpParams);
    HttpGet localHttpGet = new HttpGet(paramString1);
    if ((paramString2 != null) && (!paramString2.equals("")))
      localHttpGet.addHeader("Cookie", paramString2);
    return localDefaultHttpClient.execute(localHttpGet).getEntity().getContent();
  }
}